/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: UserState.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/21 下午2:55
 * LastModified: 2020/03/21 14:55:21
 */

package com.qolome.knowledge.design.pattern.state.gper;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Qolome
 * @version V1.0
 * @Description 未登录状态
 * @date 2020年 03月21日 14:55:49
 */
@Slf4j
public class UnLoginState extends  UserState{




    @Override
    public void favorite() {

        this.switch2Login();
        this.context.geState().favorite();

    }

    private void switch2Login() {
      log.info("跳转到登录页");
      this.context.setState(ApplicationContext.STATE_LOGIN);

    }

    @Override
    public void comment(String comment) {
        this.switch2Login();
        this.context.geState().comment(comment);
    }
}
